package com.example.pinkcat.fragment;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.pinkcat.R;
import com.example.pinkcat.activity.MakeVideoPage;
import com.example.pinkcat.adapter.Tougao_RecyclerViewAdapter;
import com.example.pinkcat.api.entity.ContributeVideoEntity;
import com.example.pinkcat.api.getData.getData_waibu;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class Fragment_tougao extends Fragment {

    private RecyclerView recyclerView;
    private Tougao_RecyclerViewAdapter tougaoAdapter;
    private Spinner mSpinnerSimple;

    Context context;

    private Spinner spinner;


    @Override
    public void onResume() {
        super.onResume();
        getData_waibu.getContribute(context);

    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_tougao,container,false);
        return view;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        context=view.getContext();
        recyclerView = view.findViewById(R.id.tougao_RV);
        recyclerView.setLayoutManager(new GridLayoutManager(view.getContext(), 1));
        tougaoAdapter = new Tougao_RecyclerViewAdapter(view.getContext());
        recyclerView.setAdapter(tougaoAdapter);


        getData_waibu.getContributeVideo(context,tougaoAdapter);
    }



}
